home *** CD-ROM | disk | FTP | other *** search
- 10 rem binary mind reader
- 20 rem and lie detector
- 30 rem by royal c. jones
- 40 gosub60100
- 50 print"[147][154]think of a number--"
- 60 print"[159]a positive integer, please"
- 80 rem first how big is it?
- 90 n$=" 1":rem the binary number
- 100 for i=1 to 29:rem lots of bits
- 110 n$=n$+"0"
- 120 print"[154]is your number less than"
- 130 print n$"[154] binary"
- 135 print" [145]"
- 140 print 2^i"[154]decimal?"
- 150 gosub 620
- 160 if a$="y" goto 240
- 170 print" [145][145]"
- 175 print"[154]then it is at least"i+1"[154]bits long"
- 180 d$=d$+"?":rem place markers
- 190 next i
- 200 print"[147] let's not get carried away!"
- 210 print" [150]think of another number"
- 220 fora=1to2000:next:run50
- 240 rem now for the number itself
- 250 n$=" 1":i=i-1:n=2^i
- 260 if n=1 goto 380:rem no question
- 270 for j=i-1 to 0 step-1:print
- 280 print"your number looks like"
- 290 print n$;left$(d$,i+2-len(n$));
- 300 print" binary"
- 310 print"is your number less than"
- 315 print" [145]"
- 320 print n+2^j"decimal?"
- 330 gosub 620
- 340 if a$="y" then n$=n$+"0":goto 360
- 350 n$=n$+"1":n=n+2^j
- 360 next j
- 380 rem eureka!
- 390 print:print"[158][147]the number you are thinking of is"
- 400 print n$" [154]binary"
- 410 print n"[154]decimal"
- 420 print:print"am i correct? [145]";
- 430 gosub 620:print
- 440 if a$="y"then print"as always":goto700
- 460 rem the lie detector
- 470 print:print"[159]what is your number:";:le=15:nu=1:al=.:gosub60500:w=val(c$)
- 480 if w=n then print"[150]aha! just as i said!":goto700
- 490 if w<>int(w) thengosub1000:goto700
- 500 if w<1 thengosub1100:goto700
- 510 t=2^i:rem the test number
- 520 if w<t goto 580
- 530 for j=i to 0 step-1
- 540 if n>=t+2^j then t=t+2^j:goto 570
- 550 if w<t+2^j goto 590
- 560 print"[150]aha! but you said it was less than":print t+2^j:goto700
- 570 if w>=t goto 590
- 580 print"[150]aha! but you said it was not less than":print t:goto700
- 590 next j
- 600 print"oh-oh! bad program":goto700
- 620 rem input subroutine
- 630 print"[154]y[154]es or n[154]o: [157][157][157]";:poke198,.
- 640 get a$:if a$<>"y"anda$<>"n"then640
- 650 print""a$"[146]":rem hilight answer
- 655 ifpeek(203)<>64then655
- 660 return
- 700 ifpeek(203)<>64then700
- 705 print"[154]would you like to me to guess another?":poke198,.
- 710 a=peek(203):ifa<>25anda<>39then710
- 720 ifa=25thenrun50
- 730 goto60000
- 1000 print"but i asked for an integer":print"try again":return
- 1100 print"but i asked for a positive number":print"try again":return
- 60000 open15,8,15,"r0:hello connect=hello connect":input#15,er:close15
- 60010 ifer<>63thenend
- 60020 load"hello connect",8
- 60100 poke53280,11:poke53281, 0:print"[147][142]";
- 60101 print"[158]loadstarpresents:"
- 60102 print"[151][160]"
- 60103 print"[176]{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}[174]"
- 60104 print"[176]{$7b}[174][176]{$7b}[174]{$7d}[173][189]";
- 60105 print"[173][189]{$7d}{$7d}{$7d}{$7d}[156]binarymind";
- 60106 print"reader{$7d}{$7d}{$7d}{$7d}[156]";
- 60107 print"royalc.jones{$7d}{$7d}{$7d}{$7d}";
- 60108 print"[156]copyright1988{$7d}{$7d}";
- 60109 print"{$7d}{$7d}[176][174][176][174]{$7d}[173]{$7b}[189]";
- 60110 print"[173]{$7b}[189][173]{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}{$60}[189]"
- 60111 print"[158]pressspacetocontinue"
- 60120 ifpeek(203)<>60then60120
- 60130 return
- 60500 c$="":poke198,.:print"[164]";
- 60510 fora=1tole+1
- 60520 geta$:ifa$=""then60520
- 60530 ifa$=chr$(13)thenprint"[157] ":return
- 60540 ifa$=chr$(20)anda>1thenprint"[157][157] [157][157][164]";:a=a-1:c$=left$(c$,a-1):goto60520
- 60550 if(a=le+1)then60520
- 60560 if(nu)and((a$>="0")and(a$<="9"))then60595
- 60570 if(al)and((a$>=" "anda$<="/")or(a$>=":"anda$<="z"))then60595
- 60580 if(al)thenif(a$>="[193]"anda$<="[218]")then60595
- 60590 goto60520
- 60595 print"[157]"a$;:poke212,.:print"[164]";:c$=c$+a$:next
-